package jobOO3;

public class AnimalTest {
    public static void main(String[] args) {
        Dog dog=new Dog("小白",6,"白");
        Dog[] dogs=new Dog[3];
        dogs[0]=new Dog("小白",3,"白");
        dogs[1]=new Dog("小黑",3,"黑");
        dogs[2]=new Dog("大黄",7,"黄");
        System.out.println(dogs[0].name);
        dogs[1].age=4;
        //dogs[2]=null;//表示为空，没有指向任何对象
        dogs[2].swim();
        for (int i=0;i<dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }

        dog.lookHome();
        dog.drink();
        dog.eat();
        dog.swim();


        Chick chick=new Chick("大黄",2,"黄");
        chick.layEaas();
        chick.drink();
        chick.eat();

        Fish fish=new Fish("小金",1,"金");
        Fish[] fishs=new Fish[4];
        fishs[0]=new Fish("小金",1,"金");
        fishs[1]=new Fish("大金",2,"金");
        fishs[2]=new Fish("小白",1,"白");
        fishs[3]=new Fish("大白",2,"白");
        for (int i=0;i<fishs.length;i++){
            System.out.println(fishs[i].name);
            fishs[i].swim();
        }


        fish.drink();
        fish.eat();
        fish.swim();


    }
}
